﻿package net.jmp0.toast.entities.menu 
{
	import flash.geom.ColorTransform;
	import punk.Actor;
	import punk.core.Spritemap;
	/**
	 * ...
	 * @author Thodd
	 */
	public class SpeechBubbleOverlay extends Actor
	{
		
		//Embedding overlay sprite
		[Embed(source = '../../res/overlay.png')] private var imgOverlay:Class;
		private var sprOverlay:Spritemap = FP.getSprite(imgOverlay, 480, 480, false, false, 100, 0, false);
		
		//talking toast
		[Embed(source = '../../res/toastFaceAnimated.png')] private var imgToastFace:Class;
		private var sprToastFace:Spritemap = FP.getSprite(imgToastFace, 100, 100, false, false, 0, 0, true);
		
		public function SpeechBubbleOverlay(x:int, y:int, depth:int) {
			this.x = x;
			this.y = y;
			this.depth = depth;
			
			this.sprite = sprToastFace;
			
			this.delay = 10;
			
			setupOverlay();
		}
		
		
		/**
		 * setting the alpha for the overlay sprite
		 */
		private function setupOverlay():void {
			//setup speech bubble sprite
			var colorT:ColorTransform = new ColorTransform();
			colorT.alphaMultiplier = 0.5;
			sprOverlay.colorTransform(sprOverlay.rect, colorT);
		}
		
		
		override public function render():void {
			super.updateImage(sprite.number);
			drawSprite(sprOverlay, 0, x, y, false, false);
			drawSprite(sprToastFace, image, x-100, y+350, false, false);
		}
		
	}

}